﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using XYTXL.AppCode;
using XYTXL.Data;
using XYTXL.API;

namespace XYTXL.View
{
    public partial class SetCenter : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                lblTitle.Text = "修改密码";
            }
        }

        protected void btSendForm_Click(object sender, EventArgs e)
        {
            string oldPwd = txtPwdO.Text;
            string newPwd = txtPwdN.Text;
             
            var jau = new JH_Auth_UserB().GetEntity(p=>p.ID==UserInfo.User.ID);
            if (jau != null)
            {
                if (oldPwd == jau.UserPass)
                {
                    jau.UserPass = newPwd;

                    if (new JH_Auth_UserB().Update(jau))
                    {
                        AlertMSG("3", "操作成功");
                        Response.Write("<script language='JavaScript'>setTimeout('window.location=document.location.href;',1000)</script>");
                    }
                }
                else
                {
                    AlertMSG("1", "旧密码错误");
                }
            }
        }
    }
}